package com.itheima.mapper;

import com.itheima.pojo.entity.Setmeal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SetmealMapper {

    @Insert("INSERT INTO t_setmeal(name, code, helpCode, sex, age, price, remark, attention, img) VALUES(#{name}, #{code}, #{helpCode}, #{sex}, #{age}, #{price}, #{remark}, #{attention}, #{img})")
    void insertSetmeal(Setmeal setmeal);

    @Update("UPDATE t_setmeal SET name=#{name}, code=#{code}, helpCode=#{helpCode}, sex=#{sex}, age=#{age}, price=#{price}, remark=#{remark}, attention=#{attention}, img=#{img} WHERE id=#{id}")
    void updateSetmeal(Setmeal setmeal);

    @Select("SELECT * FROM t_setmeal WHERE id = #{id}")
    Setmeal selectById(Integer integer);

    @Select("SELECT * FROM t_setmeal")
    List<Setmeal> selectAll();

    @Select("select * from t_setmeal ")
    List<Setmeal> getSetmeal();
}